package com.guigu.tms.manager.controller.wj;

import com.github.pagehelper.PageInfo;
import com.guigu.tms.commons.entity.base.PdTruck;
import com.guigu.tms.commons.entity.base.VehicleManagement;
import com.guigu.tms.manager.feign.wj.TruckFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController("pdTruck")
@RequestMapping("/pdTruck")
public class TruckController {

    @Autowired
    TruckFeignClient truckFeignClient;

    /**
     * 查询全部车辆信息
     * @return
     */
    @GetMapping("/findAllPdTruck")
    public List<PdTruck> findAllPdTruck(){
        return truckFeignClient.findAllPdTruck();
    }

    @PostMapping("/findTruckList")
    public PageInfo<VehicleManagement> findTruckList(@RequestBody Map<String, String> map){
        PageInfo<VehicleManagement> truckList = truckFeignClient.findTruckList(map);
        return truckList;
    }

    @PostMapping("/AddPdTruck")
    public int AddPdTruck(@RequestBody PdTruck pdTruck){
        return truckFeignClient.AddPdTruck(pdTruck);
    }

    @DeleteMapping("/DeleteTruckByid")
    public int DeleteTruckByid(@RequestParam Integer truckId){
        return truckFeignClient.DeleteTruckByid(truckId);
    }

    @PutMapping("/SaveTruck")
    public int SaveTruck(@RequestBody VehicleManagement vehicleManagement){
        return truckFeignClient.SaveTruck(vehicleManagement);
    }
}
